#ifndef ELFREADER_H
#define ELFREADER_H

#include <QString>
#include <QVector>

class ELFSymbol
{
public:
    ELFSymbol();
    ELFSymbol(unsigned long pointer);
    ELFSymbol(const QString & name, unsigned long pointer);
    
    bool operator< (const ELFSymbol & rh) const;
    bool operator== (const ELFSymbol & rh) const;
    
public:
    QString name;
    unsigned long pointer;
};

class ELFReader
{
public:
    void load(const QString & path);
    
    unsigned int size() const;
    
    bool contains(unsigned long pointer) const;
    const ELFSymbol & getNearestSymbol(unsigned long pointer) const;
    
    QString operator[] (const unsigned long pointer) const;
    unsigned long address(const QString& symbol) const;
    
private:
    QVector<ELFSymbol> symbols;
};

#endif // ELFREADER_H
